<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="/resource/UserPwoer.tld" prefix="p"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>微信支付样例-支付</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/DDMBase.js"></script>

<link rel="stylesheet" href="${path }/resource/weixin/css/login.css">

</head>

<body>

<h1>${msg }</h1>
 'getBrandWCPayRequest', {
		    		"appId" : "${payData.appId}", // 公众号名称，由商户传入
					"timeStamp" : "${payData.timeStamp}", // 时间戳，自1970年以来的秒数
					"nonceStr" : "${payData.nonceStr}", // 随机串
					"package" : "${payData.prepay_id}",
					"signType" : "${payData.signType}", // 微信签名方式:
					"paySign" : "${payData.paySign}" // 微信签名
<button id="getBrandWCPayRequest" >支付</button>
	<script type="text/javascript">
	  //当微信内置浏览器完成内部初始化后会触发WeixinJSBridgeReady事件。
	document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
		alert("init");
		//公众号支付
		$('#getBrandWCPayRequest').click(function(e){
			WeixinJSBridge.invoke('getBrandWCPayRequest',{
					"appId" : "${payData.appId}", // 公众号名称，由商户传入
					"timeStamp" :"${payData.timeStamp}", // 时间戳，自1970年以来的秒数
					"nonceStr" : "${payData.nonceStr}", // 随机串
					"package" : "${payData.prepay_id}",
					"signType" : "${payData.signType}", // 微信签名方式:
					"paySign" : "${payData.paySign}" // 微信签名
			},function(res){
				console.log(res);
				// if(res.err_msg == get_brand_wcpay_request:ok ) {
				alert( JSON.stringify(res) ); // alert("OK");
				
			});
		});
		WeixinJSBridge.log('yo~ ready.');
	}, false);
	</script>
</body>
</html>